package com.cn.distributor.controller;
import com.cn.common.result.Result;
import com.cn.distributor.service.ShopService;
import com.cn.distributor.vo.GoodsIdVo;
import com.cn.distributor.vo.ShopIdVo;
import com.cn.distributor.vo.ShopVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Api(tags = "店铺操作")
@RestController
@RequestMapping("/back/shop")
public class ShopController {

    @Autowired
    private ShopService shopService;

    @ApiOperation("显示店铺商品")
    @PostMapping("/allProduce")
    public List allProduce(ShopIdVo shopIdVo){ return  shopService.allProduce(shopIdVo); }

    @ApiOperation("上下架商品")
    @PostMapping("/Goods")
    public Result goods(GoodsIdVo goodsIdVo, ShopIdVo shopIdVo){ return  shopService.goods (goodsIdVo,shopIdVo); }

//    @ApiOperation("下架商品")
//    @PostMapping("/offGoods")
//    public Result offGoods(GoodsIdVo goodsIdVo,ShopIdVo shopIdVo){ return shopService.offGoods(goodsIdVo,shopIdVo); }

    @ApiOperation("添加商品到店铺")
    @PostMapping("/addGoods")
    public Result addGoods(GoodsIdVo goodsIdVo, ShopIdVo shopIdVo){ return shopService.addGoods(goodsIdVo,shopIdVo); }

    @ApiOperation("从店铺删除商品")
    @PostMapping("/deleteGoods")
    public Result deleteGoods(GoodsIdVo goodsIdVo, ShopIdVo shopIdVo){ return shopService.deleteGoods(goodsIdVo,shopIdVo); }

    @ApiOperation("修改店铺信息")
    @PostMapping("/modifyStore")
    public Result modifyStore(ShopVo shop, ShopIdVo shopIdVo){
        return shopService.modifyStore(shop,shopIdVo);
    }

    @ApiOperation("分享到朋友圈")
    @GetMapping("/share")
    public Result share(GoodsIdVo goodsIdVo){
        return shopService.share(goodsIdVo);
    }

    @ApiOperation("查询店铺订单")
    @GetMapping("/findByOrder")
    public Result findByOrder(ShopIdVo shopIdVo){
        return shopService.findByOrder(shopIdVo);
    }
}
